feat: route account activation emails via SES using waffle flag#37932
Conversation
c9a9d9a to
a363016
Compare
| language=preferences_api.get_user_preference(user, LANGUAGE_KEY), | ||
| user_context=message_context, | ||
| ) | ||
| if ENABLE_SES_FOR_ACCOUNT_ACTIVATION.is_enabled(): |
There was a problem hiding this comment.
Hi @nthriveni-sonata-ship-it, couple of suggestions on refactor:
-
Centralize the Routing Logic
Currently, the SES routing logic is tied specifically to the management view. To ensure it also works for initial registrations (via Celery tasks) and user-requested resends, we should pull the logic into a centralized utility.
Action: Move the WaffleFlag definitions and the check logic to: openedx/core/djangoapps/ace_common/utils.py -
Implement an Active Fallback (Safe-to-Fail) in openedx/core/djangoapps/user_authn/tasks.py
The current implementation introduces a single point of failure. If the Waffle flag is ON but the SES backend (django_email) is unreachable, the email will never be sent. We should prioritize SES but fallback to the default ACE path if it fails.
Why?
One function handles routing for all activation/course-update flows.
Even if SES has an outage, user registrations won't be blocked.
Management views and Celery tasks don't need to know the names of individual Waffle flags.
asharma4-sonata
left a comment
There was a problem hiding this comment.
Hi @nthriveni-sonata-ship-it, couple of suggestions on refactor which I have detailed in the inline comments.
This PR introduces a waffle-flag–controlled routing for Account Activation emails to be sent via SES.
What’s included:
Added a waffle flag to control SES routing for account activation emails
Updated activation email composition to override the default ACE channel to django_email when the flag is enabled
Local devstack validation using a file-based email backend to verify channel override and email generation
Testing:
Verified waffle flag behavior locally via Django admin
Confirmed ACE message options include transactional and django_email channel override
Validated rendered email output using the file-based email backend
Next steps:
– Draft PR for early review and alignment